#!/usr/bin/python
var1 = "Hello World"
var2 = "moonth"
var3 = "hello"
var4 = "world"
var5 = " abc "

#字符串运算符
print(var1[0])
print(var1[1:3])
print(var3 + var4)
print(var3 * 2)
print("w" in var4)
print("w" not in var4)

#格式化字符串
print("my name is %s and weight is %d" %('lxt',40))

#三引号，适合多行字符串
html = '''
<html>
    <head>
        <title>示例</title>
    </head>
    <body>
        <p>Hello World!</p>
    </body>
</html>
'''
print(html)

#unicode字符串
uniCode = u'Hello World !'
print(uniCode)

#字符串的常用函数
print(var4.capitalize()) #首字母大写
print(var5.strip()) #去掉左右空格

